<template>
	<view>
		<uni-card class="qr-hei" :isShadow="true">
			<uqrcode ref="uqrcode"></uqrcode>
		</uni-card>
		
		<uni-card :isShadow="true">
			<uni-section class="pub-title" title="可用优惠劵" type="line"></uni-section>
			<uni-list v-for="(item ,index) in youhjlb" :key="index">
			    <uni-list-item :title="item.youhjmingc" :note="item.youhjshiysm" :thumb="item.youhjtup"
			     thumb-size="lg" :rightText="item.fafsl"></uni-list-item>
			</uni-list>
		</uni-card>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				youhjlb: [],
				qrData: uni.getStorageSync("userInfo").phone
			}
		},
		
		onReady() {
			this.$refs.uqrcode.make({
					size: '250',
					text: this.qrData
				})
				.then(res => {
					// 返回的res与uni.canvasToTempFilePath返回一致
					console.log(res)
				})
		},
		
		onLoad() {
			let that = this
			
			uni.request({
				url: getApp().globalData.serviceUrl + "/youhjfaf/kuybYouhjFaf/wodyhjlb",
				data: {
				},
				header: {
					"X-Access-Token": uni.getStorageSync("token")
				},
				dataType: 'json',
				method: 'GET',
				success: (result) => {
					if (result.data.success) {
						that.youhjlb = result.data.result
					}
				}
			})
		},
		
		methods: {

		}
	}
</script>

<style scoped>

</style>
